/*
 * Copyright (C) 2015   Jeremy Chen jeremy_cz@yahoo.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package ipc.fdbus;

import java.util.ArrayList;

public interface FdbusServerListener
{
    /*
     * called when client is connected with the server
     * @sid - session id of the connection
     * @is_first - whether this is the first connected client
     */
    public void onOnline(int sid, boolean is_first, int qos);

    /*
     * called when client is disconnected with the server
     * @sid - session id of the connection
     * @is_last - whether this is the last connected client
     */
    public void onOffline(int sid, boolean is_last, int qos);

    /*
     * called when invokeAsync(), invokeSync() or send() is called by client
     * @msg - the message sent from client
     */
    public void onInvoke(FdbusMessage msg);

    /*
     * called when subscribe() is called from client
     * @sub_list - the list of events (and topics) subscribed by client
     */
    public void onSubscribe(FdbusMessage msg, ArrayList<SubscribeItem> sub_list);
}
